<?php
class WallAction extends Action{
	function dowall(){
		$intToUid = intval($_POST['touid']);
		$intFid   = intval($_POST['fid']);
		if($intFid){
			$map['fid'] = $intFid;
		}
		$map['fromuid']   = $this->mid;
		$map['uid']       = $intToUid;
		$map['content']   = $_POST['content'];
		$map['stealth']   = intval($_POST['stealth']);
		$map['cTime']     = time();
		if($id=D('Wall')->add($map)){
			if($intFid){
				$info = D('Wall')->where('id='.$intFid)->field('fromuid')->find();
				if($info['fromuid']) x('Notify')->put('space_replaywall',$info['fromuid']);
			}else{
				x('Notify')->put('space_addwall',$intToUid);
			}
			$map['id']       = $id;
			$map['userface'] = getUserFace($this->mid,'s');
			$map['username'] = getUserName($this->mid);
			$map['link']   = U('space/View',array('uid'=>$map['fromuid']));
			$map['cTime']    = L('index_0001');
		}else{
			$map['id']       = 0;
		}
		exit(json_encode($map));
	}


	function dodel(){
		echo D('Wall')->delWall(intval($_POST['id']),$this->mid);
	}
}
?>